/**
 * 
 */
package fr.fermeManager.application.reporting;

import java.util.List;

import fr.fermeManager.library.dao.DaoTransaction;
import fr.fermeManager.library.dao.DaoTransactionImpl;
import fr.fermeManager.library.dao.DaoTypeTransaction;
import fr.fermeManager.library.dao.DaoTypeTransactionImpl;
import fr.fermeManager.library.model.beans.Transaction;
import fr.fermeManager.library.model.beans.TypeTransaction;

/**
 * @author Mo
 *
 */
public final class DonneesJasperReport {
	
	public static List<Transaction> getListeFermes() throws Exception{
		
		DaoTransaction daoTransactions = new DaoTransactionImpl();
		
		DaoTypeTransaction daoTypeTransaction = new DaoTypeTransactionImpl();
		
		List<Transaction> listeTransactions = daoTransactions.getFermeTransactions(0,true);
		
		List<TypeTransaction> listeTypeTransactions = daoTypeTransaction.getListeTypesTransactions(0,true);
		
		for (Transaction transactionTmp : listeTransactions) {
			for (TypeTransaction typeTransaction : listeTypeTransactions) {
				if(transactionTmp.getTypeTransaction().getId() == typeTransaction.getId()){
					transactionTmp.setTypeTransaction(typeTransaction);
					break;
				}
			}
		}
		return listeTransactions;
	}
}
